Skip to content

feat(bootstrap): add Docker preflight check before gateway startup#321

Merged
drew merged 5 commits intomainfrom
docker-preflight-check/an
Mar 15, 2026
Merged

feat(bootstrap): add Docker preflight check before gateway startup#321
drew merged 5 commits intomainfrom
docker-preflight-check/an

Conversation

@drew
Copy link
Collaborator

@drew drew commented Mar 15, 2026

Summary

  • Add a Docker preflight check that runs before any gateway deploy work, failing fast with actionable guidance when Docker is unavailable
  • Expand error diagnostics and docs to support alternative Docker-compatible runtimes (OrbStack, Colima, Podman via DOCKER_HOST)
  • Add e2e tests verifying the preflight catches Docker issues in seconds, not minutes

Motivation

When a user runs openshell gateway start or openshell sandbox create without Docker running (or with a non-default runtime like OrbStack), the CLI would spend several minutes pulling images and waiting for k3s before timing out with a cryptic "K8s namespace not ready" error. Users had no indication that Docker was the problem or how to fix it.

From user feedback: a first-time user with OrbStack installed hit "Socket not found: /var/run/docker.sock" immediately, then after setting up OrbStack hit "K8s namespace not ready" and couldn't recover without manual debugging and setting DOCKER_HOST.

Changes

Core preflight (crates/openshell-bootstrap/src/docker.rs)

  • New check_docker_available() async function that connects, pings, and queries version
  • docker_not_reachable_error() builds context-aware diagnostics:
    • No socket + no DOCKER_HOST: suggests installing a runtime, probes alternative socket paths
    • DOCKER_HOST set but unresponsive: shows the current value
    • Socket exists but daemon down: suggests starting the runtime
  • find_alternative_sockets() probes ~/.colima/docker.sock and ~/.orbstack/run/docker.sock

Integration (crates/openshell-bootstrap/src/lib.rs)

  • check_existing_deployment() and deploy_gateway_with_logs() now call the preflight for local deploys
  • Covers both openshell gateway start and auto-bootstrap via sandbox create

Error patterns (crates/openshell-bootstrap/src/errors.rs)

  • Added "Socket not found", "No such file or directory", preflight error strings to FAILURE_PATTERNS
  • Updated recovery steps to mention DOCKER_HOST configuration
  • Removed product-specific runtime names from CLI error text (kept in docs only)

Documentation

  • README.md: lists Docker Desktop, OrbStack, Docker Engine as supported; notes tested on Docker 28.04
  • docs/get-started/quickstart.md: broadened prerequisite to "Docker-compatible runtime"
  • docs/reference/support-matrix.md: added OrbStack to platform table, listed runtimes, documented DOCKER_HOST
  • docs/tutorials/first-network-policy.md: updated prerequisite wording

E2E tests (e2e/rust/tests/docker_preflight.rs)

6 tests that point DOCKER_HOST at a non-existent socket and verify:

  • gateway start fails in <30s (not minutes)
  • Error output mentions "Docker", "DOCKER_HOST", and "docker info"
  • --recreate flag doesn't bypass the check
  • sandbox create auto-bootstrap path also fails fast

Testing

  • 9 new unit tests in openshell-bootstrap (all pass)
  • 6 new e2e tests (all pass in <1s total)
  • mise run pre-commit passes
  • mise run test passes (all 77 bootstrap + 64 CLI tests)

Fail fast with actionable guidance when Docker is not installed, not
running, or unreachable instead of starting a multi-minute deploy that
times out with a cryptic error.

- Add check_docker_available() preflight that pings the Docker daemon
  before any gateway work begins
- Integrate into both gateway start and sandbox create auto-bootstrap
- Probe alternative socket paths (~/.orbstack, ~/.colima) and suggest
  DOCKER_HOST when no default socket is found
- Expand FAILURE_PATTERNS to match socket-not-found errors
- Update docs to list supported Docker-compatible runtimes
- Add e2e tests verifying fast failure and error message quality
@drew drew self-assigned this Mar 15, 2026
drew added 2 commits March 14, 2026 23:56
…dation

Adds 'openshell doctor check' that validates Docker connectivity before
gateway setup. Reports pass/fail with version info and DOCKER_HOST
status, giving users a quick way to verify their environment.
@github-actions
Copy link

github-actions bot commented Mar 15, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-03-15 16:45 UTC

@drew drew added the test:e2e Requires end-to-end coverage label Mar 15, 2026
@drew drew merged commit 37ee051 into main Mar 15, 2026
10 checks passed
@drew drew deleted the docker-preflight-check/an branch March 15, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant